<?php
class ControllerCommonHome extends Controller {
	public function index() {
		$this->document->setTitle($this->config->get('config_meta_title'));
		$this->document->setDescription($this->config->get('config_meta_description'));
		$this->document->setKeywords($this->config->get('config_meta_keyword'));

		if (isset($this->request->get['route'])) {
			$this->document->addLink($this->config->get('config_url'), 'canonical');
		}

        //最新三条新闻
        $this->load->model('press/press');

        $this->load->model('tool/image');

        $filter_data = array(
            'start'              => 0,
            'limit'              => 3
        );

        $results = $this->model_press_press->getPresses($filter_data);
        foreach ($results as $result) {
            $data['presses'][] = array(
                'image'  	   		=> $this->model_tool_image->resize($result['image'], 400, 300),
                'title'        		=> html_entity_decode($result['title'], ENT_QUOTES, 'UTF-8'),
                'out_link'				=> $result['out_link']
            );
        }
        $data['column_left'] = $this->load->controller('common/column_left');
		$data['column_right'] = $this->load->controller('common/column_right');
		$data['content_top'] = $this->load->controller('common/content_top');
		$data['content_bottom'] = $this->load->controller('common/content_bottom');
		$data['footer'] = $this->load->controller('common/footer');
		$data['header'] = $this->load->controller('common/header');
        $data['news'] = $data['presses'];

        //$data['banner'] = $this->load->controller('extension/module/banner');

		$this->response->setOutput($this->load->view('common/home', $data));
	}
}
